package cn.doitedu.ml.textvec

import java.util

import com.hankcs.hanlp.HanLP
import com.hankcs.hanlp.dictionary.py.Pinyin
import com.hankcs.hanlp.seg.common.Term

import scala.collection.mutable

object HanlpDemo {
  def main(args: Array[String]): Unit = {

    val s = "我有一头小毛驴我从来也不骑，有一天我心血来潮骑着去赶集，不怎么哗啦啦摔了一身泥，抬头一看，到了多易"

    val str: String = HanLP.convertToPinyinFirstCharString(s, ",", false)

    // println(str)

    val pinyins: util.List[Pinyin] = HanLP.convertToPinyinList(s)
    import scala.collection.JavaConversions._
    for( p <- pinyins) {
      //println(p)
    }

    val str1 = HanLP.convertToTraditionalChinese(s)
    //println(str1)


    val terms: util.List[Term] = HanLP.segment(s)
    val words: mutable.Seq[String] = terms.map(term => term.word)

    for (elem <- words) {
      print(elem+"|")
    }





  }

}
